home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)td.d64
/
lottery.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
222 lines
10 POKE53280,0:POKE53281,0:CLOSE3:CLR
15 DIMPN(150),N$(25),PN$(25),DN(25):OPEN3,0
20 GOSUB5000
30 PRINT"1) LOTTARIO"
40 PRINT"2) LOTTO 649"
50 PRINT"3) WINTARIO"
55 PRINT"4) END"
60 PRINT"SELECT #:"
70 GETA$:IFA$=""THEN70
80 IFA$="1"THENHL=39:X=0:A$="LOTTARIO":GOTO160
90 IFA$="2"THENHL=49:X=1:A$="LOTTO 649":GOTO160
100 IFA$="3"THEN3050
105 IFA$="4"THENCLOSE3:PRINT"[147]":END
110 GOTO70
160 IFXTHENGOSUB1020:GOTO170
165 GOSUB960
170 PRINT""SPC(5)"1) ENTER NEW TICKET NUMBERS"
175 PRINTSPC(5)"2) ADD NUMBERS TO TICKET LIST"
180 PRINTSPC(5)"3) ENTER WINNING "A$" NUMBERS"
190 PRINTSPC(5)"SELECT #:"
200 GETS$:IFS$="1"THEN230
205 IFS$="2"THENGOSUB580:GOTO240
210 IFS$="3"THENGOSUB580:GOTO360
220 S$="":GOTO200
230 T=1:L=0
240 IFXTHENGOSUB1020:GOTO250
245 GOSUB960
250 PRINT""SPC(3)"TICKET PURCHASED BY:";:INPUT#3,N$(T):PRINT
260 PRINT""SPC(3)"ENTER TICKET NUMBERS:"
270 FORC=(L+1)TO(L+6)
280 PRINTSPC(22)"# ";:INPUT#3,PN(C):PRINT
290 IFPN(C)>HLTHENPN(C)=0:PRINT"[145][145]":GOTO280
300 NEXT
301 IFXTHEN310
305 PRINT""SPC(3)"ENTER DAY NUMBER OF TICKET PURCHASE:"
306 PRINT""SPC(6)"1) SUN 2) MON 3) TUES 4) WED"
307 PRINTSPC(10)"5) THUR 6) FRI 7) SAT"
308 GETS$:IFS$=""THEN308
309 DN(T)=VAL(S$):IFDN(T)<0ORDN(T)>7THEN308
310 PRINT""SPC(3)"['Q' - QUIT 'C' - CONTINUE]"
320 S$="":GETS$
330 IFS$="C"THENT=T+1:L=L+6:GOTO240
340 IFS$="Q"THEN490
350 GOTO320
360 IFXTHENGOSUB1020:GOTO370
365 GOSUB960
370 PRINTSPC(5)"ENTER WINNING NUMBERS:"
380 FORC=1TO6
390 PRINTSPC(24)C"[157]:";:INPUT#3,WN(C):PRINT
400 IFWN(C)>HLTHENWN(C)=0:PRINT"[145][145]":GOTO390
410 NEXT
420 PRINTSPC(5)"ENTER BONUS NUMBER:";:INPUT#3,BN:PRINT
430 IFBN>HLTHENBN=0:PRINT"[145][145]":GOTO420
435 IFXTHEN650
440 PRINTSPC(5)"ENTER EARLYBIRD NUMBERS:"
450 FORC=1TO4
460 PRINTSPC(26)C"[157]:";:INPUT#3,EB(C):PRINT
470 IFEB(C)>HLTHENEB(C)=0:PRINT"[145][145]":GOTO460
480 NEXT:GOTO650
490 OPEN15,8,15,"S0:"+A$
500 CLOSE15
510 OPEN5,8,5,"0:"+A$+",S,W"
520 T=1:L=0:Z$=CHR$(13)
530 IFN$(T)=""THENCLOSE5:RUN
540 PRINT#5,N$(T);Z$;
541 IFXTHEN550
542 PRINT#5,DN(T);Z$;
550 FORC=(L+1)TO(L+6)
560 PRINT#5,PN(C);Z$;
570 NEXTC:L=L+6:T=T+1:GOTO530
580 OPEN5,8,5,"0:"+A$+",S,R"
590 T=1:L=0
600 INPUT#5,N$(T)
601 IFXTHEN610
602 INPUT#5,DN(T)
610 FORC=(L+1)TO(L+6):INPUT#5,PN(C):NEXTC
620 T=T+1:L=L+6
630 IFSTTHENCLOSE5:RETURN
640 GOTO600
650 L=0:MCH=0:T=1:WBN=0:WEB=0
655 IFXTHENGOSUB1020:GOTO670
660 GOSUB960
670 PRINT""N$(T)"'S TICKET:"
680 FORA=1TO6
690 FORC=(L+1)TO(L+6)
700 IFWN(A)=PN(C)THENMCH=MCH+1
710 NEXTC:NEXTA
715 PRINT"TICKET #:";
720 FORC=(L+1)TO(L+6):PRINTPN(C);:NEXTC
725 PRINT
730 IF(MCH<5)OR(MCH>5)THEN765
740 FORC=(L+1)TO(L+6)
750 IFBN=PN(C)THENWBN=1
760 NEXT
765 IFXTHEN840
770 PRINT"EARLYBIRD DRAW:";
771 IFDN(T)>4THENPRINT"NOT ELIGIBLE":GOTO840
780 FORA=1TO4
790 FORC=(L+1)TO(L+6)
800 IFEB(A)=PN(C)THENWEB=WEB+1
810 NEXTC:NEXTA
820 IFWEB=4THENPRINT"EARLYBIRD WINNER":GOTO840
830 PRINT"NO EARLYBIRD PRIZE"
840 PRINT""N$(T)" HAS MATCHED"MCH"NUMBERS."
850 IFMCH=3THENPRINT"THIS TICKET WON 5TH PRIZE"
860 IFMCH=4THENPRINT"THIS TICKET WON 4TH PRIZE"
870 IF(MCH=5)AND(WBN=0)THENPRINT"THIS TICKET WON 3RD PRIZE"
880 IF(MCH=5)AND(WBN=1)THENPRINT"THIS TICKET WON 2ND PRIZE"
890 IFMCH=6THENPRINT"THIS TICKET WON THE JACKPOT[146]"
900 MCH=0:T=T+1:L=L+6:WBN=0:WEB=0
910 PRINT""SPC(5)"[PRESS <RETURN> TO CONTINUE]"
920 S$="":GETS$:IFS$=CHR$(13)THEN940
930 GOTO920
940 IFN$(T)=""THENRUN
950 GOTO660
960 PRINT"[147] [161] [207][184][208] [184][208][183][184] [184][208][183][184] [207][184][208] [207][184][208] [207][184][208] [208][183] [207][184][208]"
980 PRINT" [180] [180][160][170] [170] [170] [204][185][186] [204][185][186] [204][185][186] [170] [180] [170] "
990 PRINT" [180] [180] [170] [170] [170] [180] [170] [180][205] [180][205] [170] [180] [170] "
1000 PRINT" [204][175][162] [204][185][186] [170][180] [170][180] [161] [182] [161] [205] [161] [205] [186][175] [204][185][186] [151]"
1010 RETURN
1020 PRINT"[147]"SPC(3)"[180] [207][184][208] [183][208][183][183] [183][208][183][183] [207][184][208] [207][183][183] [180] [182] [207][183][208]"
1030 PRINTSPC(3)"[180] [180][160][170] [170] [170] [180] [170] [180] [180] [182] [204][175][186]"
1040 PRINTSPC(3)"[180] [180] [170] [170] [170] [180] [170] [207][183][208] [204][175][186] [170]"
1050 PRINTSPC(3)"[204][175][162] [204][185][186] [170][180] [170][180] [204][185][186] [204][175][186] [182] [185][186][151]"
1060 RETURN
2220 GOSUB4000:M=0:C=1:PRINT"ENTER GRAND PRIZE NUMBER:";:INPUT#3,A$:PRINT
2230 FORT=1TO3:PRINT"100,000 WINNING NUMBER -:";:INPUT#3,C$(T):PRINT:NEXT
2240 FORT=1TO2:PRINT"10,000 WINNING NUMBERS -:";:INPUT#3,D$(T):PRINT:NEXT
2250 PRINT"1,000 WINNING NUMBER ---:";:INPUT#3,E$:PRINT
2260 PRINT"$100 WINNING NUMBER ----:";:INPUT#3,F$:PRINT
2265 PRINT"SCRAMBLE NUMBER --------:";:INPUT#3,K$:PRINT
2270 PRINT"$10 WINNING NUMBER -----:";:INPUT#3,G$:PRINT
2280 PRINT"WIN'FALL NUMBER --------:";:INPUT#3,H$:PRINT
2290 PRINT"MYSTERY NUMBER ---------:";:INPUT#3,J$:PRINT
2291 PRINT"ARE ALL NUMBERS ENTERED CORRECTLY (Y/N)"
2292 S$="":GETS$:IFS$=""THEN2292
2293 IFS$="Y"THEN2310
2294 IFS$="N"THENRUN
2295 GOTO2292
2310 GOSUB4000:M=0:PRINT""N$(C)"'S TICKET"
2320 L$=MID$(A$,2):P$=MID$(PN$(C),2)
2330 IFA$=PN$(C)THENPRINT"YOU WON $200,000":M=1:GOTO2420
2340 IFL$=P$THENPRINT"YOU WON $25,000":M=1:GOTO2420
2350 FORT=5TO3STEP-1
2360 IFLEFT$(L$,T)=LEFT$(P$,T)THEN2780
2390 IFRIGHT$(L$,T)=RIGHT$(P$,T)THEN2780
2400 NEXT
2420 FORT=1TO3
2430 IFC$(T)=PN$(C)THENPRINT"YOU WON $100,000":M=1
2435 IFF$=MID$(P$,T,4)THENPRINT"YOU WON $100":M=1
2440 NEXT
2460 FORT=1TO2
2470 IFD$(T)=P$THENPRINT"YOU WON $10,000":M=1
2510 IFE$=MID$(P$,T,5)THENPRINT"YOU WON $1,000":M=1
2520 NEXT
2580 FORT=1TO4
2590 IFG$=MID$(P$,T,3)THENPRINT"YOU WON $10":M=1
2600 NEXT
2620 FORT=1TO5
2630 IFH$=MID$(P$,T,2)THENPRINT"YOU WON A BOOK OF TICKETS":M=1
2640 NEXT
2660 IFJ$=P$THENPRINT"YOU ARE A MYSTERY PRIZE WINNER":M=1
2680 Y=6:K1$=K$
2690 FORZ=1TOY:FORT=1TOY
2700 IFMID$(K1$,Z,1)=MID$(P$,T,1)THEN2740
2710 NEXTT:NEXTZ
2720 IFP$=""THENPRINT"YOU WON THE $50 SCRAMBLE PRIZE":M=1
2721 IFM=0THENPRINT"SORRY,THIS TICKET WINS NOTHING"
2725 PRINT""SPC(5)"[PRESS <RETURN> TO CONTINUE]"
2730 S$="":GETS$:IFS$=CHR$(13)THEN2733
2732 GOTO2730
2733 C=C+1
2735 IFN$(C)=""THENRUN
2736 GOTO2310
2740 P$=MID$(P$,1,T-1)+MID$(P$,T+1)
2750 K1$=MID$(K1$,1,Z-1)+MID$(K1$,Z+1)
2760 Y=Y-1:IFY=0THEN2720
2770 GOTO2690
2780 IFT=5THENPRINT"YOU WON $5000"
2790 IFT=4THENPRINT"YOU WON $100"
2800 IFT=3THENPRINT"YOU WON $10"
2805 M=1
2810 GOTO2420
2900 OPEN15,8,15,"S0:WINTARIO":CLOSE15
2910 OPEN5,8,5,"0:WINTARIO,S,W"
2920 Z$=CHR$(13):C=1
2930 IFN$(C)=""THENCLOSE5:RUN
2940 PRINT#5,N$(C);Z$;PN$(C);Z$;
2950 C=C+1:GOTO2930
2960 OPEN5,8,5,"0:WINTARIO,S,R"
2970 C=1
2980 INPUT#5,N$(C):INPUT#5,PN$(C)
2990 C=C+1:IFSTTHENCLOSE5:RETURN
3000 GOTO2980
3050 GOSUB4000:PRINT""SPC(4)"1) ENTER NEW TICKET NUMBER"
3060 PRINTSPC(4)"2) ADD TO TICKET LIST"
3070 PRINTSPC(4)"3) ENTER WINTARIO DRAW NUMBERS"
3080 S$="":GETS$:IFS$="1"THEN3200
3090 IFS$="2"THENGOSUB2960:GOTO3205
3100 IFS$="3"THENGOSUB2960:GOTO2220
3110 GOTO3080
3200 C=1
3205 GOSUB4000
3210 PRINT""SPC(3)"TICKET PURCHASED BY:";:INPUT#3,N$(C):PRINT
3220 PRINT""SPC(3)"ENTER TICKET NUMBER:";:INPUT#3,PN$(C):PRINT
3230 PRINT"":FORQ=1TO18:PRINT:NEXT
3240 PRINT""SPC(3)"['Q' - QUIT 'C' - CONTINUE]"
3250 S$="":GETS$:IFS$=""THEN3250
3270 IFS$="C"THENC=C+1:GOTO3205
3280 IFS$="Q"THEN2900
3290 GOTO3250
4000 PRINT"[147]"SPC(3)"[161] [182][180][182] [182][205] [161] [207][208][207][208] [170][207][183][208] [207][184][208] [182] [207][184][208]"
4010 PRINTSPC(3)"[181][167][181][182] [182] [182] [205] [181] [170][180] [170][180] [170] [204][185][186] [182] [180] [170]"
4020 PRINTSPC(3)"[181][167][165][182] [182] [182] [205][181] [170][180] [170][207][183][208] [180][205] [182] [180] [170]"
4030 PRINTSPC(3)"[205][206][205][206] [182][180][182][180] [161] [170][181] [170][181] [170][180] [181] [205] [182][180] [204][185][186][151]"
4040 RETURN
5000 PRINT"[147] [181] [207][184][184][208] [184][183][208][207][183][184] [184][183][208][207][183][184] [207][183][183][184] [207][184][184][208] [205] [206]"
5010 PRINT" [181] [180] [170] [170][180] [170][180] [204][185] [204][185][185][186] [205][206]"
5020 PRINT" [181] [180] [170] [170][180] [170][180] [180] [180] [205] [170][180]"
5030 PRINT" [204][185][185][185] [204][185][185][186] [170][181] [170][181] [204][175][175][185] [181] [205] [170][180][151]"
5040 RETURN